

package com.hazelcast.jet.impl.execution;

import com.hazelcast.internal.metrics.DynamicMetricsProvider;
import com.hazelcast.internal.metrics.MetricDescriptor;
import com.hazelcast.internal.metrics.MetricsCollectionContext;
import com.hazelcast.jet.core.Processor;
import com.hazelcast.jet.impl.util.ProgressState;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public interface Tasklet extends DynamicMetricsProvider {

    default void init() {
    }

    @Nonnull
    ProgressState call();

    default boolean isCooperative() {
        return true;
    }

    default void close() {
    }

    @Nullable
    default Processor.Context getProcessorContext() {
        return null;
    }

    @Override
    default void provideDynamicMetrics(MetricDescriptor tagger, MetricsCollectionContext context) {
    }

}
